import { EVENT_TYPES } from '@/store/models/events-data'

const MENU_PATTERN = [
  {index: 1, eventType:"anchor", value:'anchor', compType:'DropdownNormal', name: '页面跳转', placeholder:"页面-1", label:"页面id"},
  {index: 2, eventType:"layer", value:'layer', compType:'DropdownNormal', name: '弹层页面', placeholder:"弹层-1", label:"弹层id"},
  {index: 3, eventType:"anchorInPage", value:'anchorInPage', compType:'InputNormal', name: '页面内锚点跳转', placeholder:"锚点id", label:"锚点id"},
  {index: 4, eventType:"compVisibleInComps", value:'compVisibleInComps', compType:'InputNormal', name: '组件显示', placeholder:"组件id", label:"组件id"},
  {index: 0, eventType:"link", value:'link', compType:'InputNormal', name: '网页链接', placeholder:"https://www.xxx.com", label:"网址地址"},
]
const EVENT_HOVER_WEB_TYPES = {
  // 'pop-repost': {label: "触发事件", isHover:false, classStrHover:'btn-event-event-hover event-sprite-hover', classStr:'btn-event-event event-sprite', },
  /** 控件类 **/
  showOrHide: {type: 'showOrHide', label: "组件可见", classStrHover:'btn-event-event-hover event-sprite-hover', classStr:'btn-event-event event-sprite', },
  layer: {type: 'layer', label: "触发弹层", classStrHover:'btn-event-layer-hover event-sprite-hover', classStr:'btn-event-layer event-sprite', },
  layerClose: {type: 'layerClose', label: "关闭弹层", classStrHover:'btn-event-layer-hover event-sprite-hover', classStr:'btn-event-layer event-sprite', },
  saveImg: {type: 'saveImg', label: "截图后保存", classStrHover:'btn-event-layer-hover event-sprite-hover', classStr:'btn-event-layer event-sprite', },
  openPush: {type: 'openPush', label: "呼起发博框", classStrHover:'btn-event-layer-hover event-sprite-hover', classStr:'btn-event-layer event-sprite', },
  rotate3d: {type: 'rotate3d', label: "3d旋转", classStrHover:'btn-event-layer-hover event-sprite-hover', classStr:'btn-event-layer event-sprite', },
  interactionData: {type: 'interactionData', label: "自定义数据", classStrHover:'btn-event-layer-hover event-sprite-hover', classStr:'btn-event-layer event-sprite', },
  compareInComps: {type: 'compareInComps', label: "组件间数据", classStrHover:'btn-event-layer-hover event-sprite-hover', classStr:'btn-event-layer event-sprite', },
  frontEvents: {type: 'frontEvents', label: "前端触发", classStrHover:'btn-event-layer-hover event-sprite-hover', classStr:'btn-event-layer event-sprite', },
  shake: {type: 'shake', label: "摇一摇", classStrHover:'btn-event-layer-hover event-sprite-hover', classStr:'btn-event-layer event-sprite', },
  scanQRCode: {type: 'scanQRCode', label: "扫一扫", classStrHover:'btn-event-layer-hover event-sprite-hover', classStr:'btn-event-layer event-sprite', },
  animate: {type: 'animate', label: "动画", classStrHover:'btn-event-layer-hover event-sprite-hover', classStr:'btn-event-layer event-sprite', },
  checkWeibo: {type: 'checkWeibo', label: "非微博提示", classStrHover:'btn-event-layer-hover event-sprite-hover', classStr:'btn-event-layer event-sprite', },

  /** 链接类 **/
  link: {type: 'link', label: "网页链接", classStrHover:'btn-event-link-hover event-sprite-hover', classStr:'btn-event-link event-sprite', },
  dial: {type: 'dial', label: "拨打电话", classStrHover:'btn-event-dial-hover event-sprite-hover', classStr:'btn-event-dial event-sprite', },
  anchor: {type: 'anchor', label: "页面跳转", classStrHover:'btn-event-anchor-hover event-sprite-hover', classStr:'btn-event-anchor event-sprite', },
  email: {type: 'email', label: "邮件", classStrHover:'btn-event-email-hover event-sprite-hover', classStr:'btn-event-email event-sprite', },
  share: {type: 'share', label: "分享", classStrHover:'btn-event-share-hover event-sprite-hover', classStr:'btn-event-share event-sprite', },

  /** 微博事件 **/
  submit: {type: 'submit', label: "表单提交", classStrHover:'btn-event-link-hover event-sprite-hover', classStr:'btn-event-link event-sprite', },
  smsVerification: {type: 'smsVerification', label: "短信验证", classStrHover:'btn-event-layer-hover event-sprite-hover', classStr:'btn-event-layer event-sprite', },
  vote: {type: 'vote', label: "投票", classStrHover:'btn-event-share-hover event-sprite-hover', classStr:'btn-event-share event-sprite', },
  number: {type: 'number', label: "计数", classStrHover:'btn-event-share-hover event-sprite-hover', classStr:'btn-event-share event-sprite', },
  push: {type: 'push', label: "发博", classStrHover:'btn-event-share-hover event-sprite-hover', classStr:'btn-event-share event-sprite', },
  repost: {type: 'repost', label: "转发", classStrHover:'btn-event-share-hover event-sprite-hover', classStr:'btn-event-share event-sprite', },
  praise: {type: 'praise', label: "赞", classStrHover:'btn-event-share-hover event-sprite-hover', classStr:'btn-event-share event-sprite', },
  follow: {type: 'follow', label: "关注", classStrHover:'btn-event-share-hover event-sprite-hover', classStr:'btn-event-share event-sprite', },
  isFollow: {type: 'isFollow', label: "是否关注", classStrHover:'btn-event-share-hover event-sprite-hover', classStr:'btn-event-share event-sprite', },
  reposts: {type: 'reposts', label: '博文组', classStrHover:'btn-event-share-hover event-sprite-hover', classStr:'btn-event-share event-sprite', },
  user: {type: 'user', label: "微博用户", classStrHover:'btn-event-share-hover event-sprite-hover', classStr:'btn-event-share event-sprite', },
  rankFriend: {type: 'rankFriend', label: "好友列表", classStrHover:'btn-event-share-hover event-sprite-hover', classStr:'btn-event-share event-sprite', },
  generalNum: {type: 'generalNum', label: "通用计数", classStrHover:'btn-event-share-hover event-sprite-hover', classStr:'btn-event-share event-sprite', },
  judgeRightWrong: {type: 'judgeRightWrong', label: "获取通用", classStrHover:'btn-event-share-hover event-sprite-hover', classStr:'btn-event-share event-sprite', },
  activityInfo: {type: 'activityInfo', label: "活动信息", classStrHover:'btn-event-share-hover event-sprite-hover', classStr:'btn-event-share event-sprite', },
  general: {type: 'general', label: "触发通用", classStrHover:'btn-event-share-hover event-sprite-hover', classStr:'btn-event-share event-sprite', },
  lottery: {type: 'lottery', label: "抽奖", classStrHover:'btn-event-share-hover event-sprite-hover', classStr:'btn-event-share event-sprite', },
  packet: {type: 'packet', label: "红包", classStrHover:'btn-event-share-hover event-sprite-hover', classStr:'btn-event-share event-sprite', },
  msg: {type: 'msg', label: "私信", classStrHover:'btn-event-share-hover event-sprite-hover', classStr:'btn-event-share event-sprite', },
  statisticData: {type: 'statisticData', label: "统计数据", classStrHover:'btn-event-share-hover event-sprite-hover', classStr:'btn-event-share event-sprite', },
  numberDayExists: {type: 'numberDayExists', label: "每天计数", classStrHover:'btn-event-share-hover event-sprite-hover', classStr:'btn-event-share event-sprite', },
  getData: {type: 'getData', label: "获取数据", classStrHover:'btn-event-share-hover event-sprite-hover', classStr:'btn-event-share event-sprite', },

  /** 其他 **/
  anchorInPage: {type: 'anchorInPage', label: "页面内锚点跳转", classStrHover:'btn-event-link-hover event-sprite-hover', classStr:'btn-event-link event-sprite', },
  timer: {type: 'timer', label: '倒计时', classStrHover:'btn-event-share-hover event-sprite-hover', classStr:'btn-event-share event-sprite', },
  site: {type: 'site', label: '站点数据', classStrHover:'btn-event-share-hover event-sprite-hover', classStr:'btn-event-share event-sprite', },
  customUser: {type: 'customUser', label: '自定用户', classStrHover:'btn-event-share-hover event-sprite-hover', classStr:'btn-event-share event-sprite', },
}
const WB_ATTR = {resultType: 1, successPanelId: 0, successCompId: '', failPanelId: 0, failCompId: '', link:'', eventType:''}

const EVENT_ATTR = {
  '1000': {controlId: '1000', wbAttr: _.cloneDeep(WB_ATTR), title:"微博列表设置"},
  '1001': {controlId: '1001', wbAttr: _.cloneDeep(WB_ATTR), title:"投票UI设置"},
  '1002': {controlId: '1002', wbAttr: _.cloneDeep(WB_ATTR), title:"计数设置"},
  '1003': {controlId: '1003', wbAttr: _.cloneDeep(WB_ATTR), title:"转发博文设置"},
  '1004': {controlId: '1004', wbAttr: _.cloneDeep(WB_ATTR), title:"原发博文设置"},
  '1005': {controlId: '1005', wbAttr: _.cloneDeep(WB_ATTR), title:"私信参数设置"},
  '1006': {controlId: '1006', wbAttr: _.cloneDeep(WB_ATTR), title:"点赞设置"},
  '1007': {controlId: '1007', wbAttr: _.cloneDeep(WB_ATTR), title:"关注参数设置"},
  '1008': {controlId: '1008', wbAttr: _.cloneDeep(WB_ATTR), title:"红包参数设置"},
  '1009': {controlId: '1009', wbAttr: _.cloneDeep(WB_ATTR), title:"抽奖参数设置"},
  '1010': {controlId: '1010', wbAttr: _.cloneDeep(WB_ATTR), title:"博文组"},
  '1011': {controlId: '1011', wbAttr: _.cloneDeep(WB_ATTR), title:"好友排行榜"},
  '1012': {controlId: '1012', wbAttr: _.cloneDeep(WB_ATTR), title:"判断对错"},
  '1013': {controlId: '1013', wbAttr: _.cloneDeep(WB_ATTR), title:"用户信息"},
  '1014': {controlId: '1014', wbAttr: _.cloneDeep(WB_ATTR), title:"活动信息"},
  '1015': {controlId: '1015', wbAttr: _.cloneDeep(WB_ATTR), title:"通用接口"},
  '1016': {controlId: '1016', wbAttr: _.cloneDeep(WB_ATTR), title:"通用计数"},
  '1017': {controlId: '1017', wbAttr: _.cloneDeep(WB_ATTR), title:"牧场数据"},
  '1018': {controlId: '1018', wbAttr: _.cloneDeep(WB_ATTR), title:"每天是否计数"},
  // 'pop': {controlId: 'pop', wbAttr: _.cloneDeep(WB_ATTR), title:"弹层数据"},
  'link': {controlId: 'link', wbAttr: _.cloneDeep(WB_ATTR), title:"每天是否计数"},
  'submit': {controlId: 'submit', wbAttr: _.cloneDeep(WB_ATTR), title:"表单提交"},
  'smsVerification': {controlId: 'smsVerification', wbAttr: _.cloneDeep(WB_ATTR), title:"表单提交"},
  'timer': {controlId: 'timer', wbAttr: _.cloneDeep(WB_ATTR), title:"倒计时"},
  'site': {controlId: 'site', wbAttr: _.cloneDeep(WB_ATTR),title:"站点信息"},
  'customUser': {controlId: 'customUser', wbAttr: _.cloneDeep(WB_ATTR),title:"自定义用户信息"},
}
const ROTATE3D_LIST = [{url:''}]
const INTERACTION_DATA = { isDimension: false, lists: [{url:""}], dimensionLists: [[{url:""}]]}


let allEvents: IWebAllEvent | null = null 
function getEventsMap() {
  if(allEvents){
    return allEvents
  }else{
    allEvents = {}
    _.forEach(EVENT_TYPES, (events: IEventMap) =>{
      _.forEach(events, (event: IEvent) => {
        allEvents![event.type] = event
      })
    })
    return allEvents
  }
}
const MOUSE_BEHAVIOR = [
  { value:"click", name:'点击' },
  { value:"load", name:'加载' },
  { value:"data", name:'数据' },
]
const EVENTS_RESULTS_TYPES = [
  { name:'页面属性', value:5 },
  { name:'弹层属性', value:1 },
  { name:'组件属性', value:2 },
  { name:'跳转链接', value:3 },
  { name:'不显示信息', value:4 },
]
const OPEN_PUSH_TYPES = [
  { name:'文字', value:0 },
  { name:'选图', value:1 },
  { name:'拍照', value:2 },
  { name:'POI', value:3 },
  { name:'长微博', value:4 },
  { name:'话题', value:6 },
  { name:'选视频', value:9 },
]
const TOAST = {
  anchor: ['','随机打开页面id，逗号分隔',{"pages":[2,3,4],"relateCompId":""}],
  layer: ['','获取表单数据动态替换弹层中的动态文本和图片，组件id用，分隔',{"allRange":[0,5],"range":['1,5','0'],"popId":[3,4]},{"pops":[2,3],"relateCompId":""}],
  submit: [{"successText":"提交成功！","failText":"提交失败！"},'多选关联id',{"groupCompId":"组件id"}],
  smsVerification: [{"smsVerification":"验证码已发送！","failText":"失败了！"}],
  vote: [{"successText":"投票成功了！","failText":"投票失败了！"}],
  number: [{"successText":"计数成功了！","failText":"计数失败了！"},'',{"relateCompId":"compId"}],
  push: [{"successText":"已发布助力了！","failText":"发布助力！"}],
  repost: [{"successText":"转发成功了！","failText":"转发失败了！"}],
  praise: [{"successText":"点赞成功了！","failText":"点赞失败了！"}],
  follow: [{"successText":"关注成功了！","failText":"关注失败了！"}],
  lottery: [{"code":"","default":"","successText":"抽奖成功了！","failText":"抽奖失败了！","notEnough":""}],
  packet: [{"successText":"红包领取成功了！","failText":"红包领取失败了！"}],
  msg: [{"successText":"发送私信成功！","failText":"发送私信失败了！"}],
  compareInComps: [{"compId":"组件id","compareCompId":"组件id","hint":"自定义不满足条件提示","popId":"弹层id","pageId":"页面id"}],
  saveImg: ['给关联发博$id$设置数据','截图组件$id$','需要被替换图片组件$id$','$id$,$id$'],
  rotate3d: ['','','',{"delayTime": 1}],
  showOrHide:[{"displayCompId":"组件id","hiddenCompId":"组件id","synCompIds":"原id,目标id","time":"时间格式"}],
  interactionData: [{"card":{1:1,2:2,3:3,4:4,5:5},"time":"2021/03/25"}],
  frontEvents: ['', {"textCompId":"compId","randomArr":[2,3],"notSameArr":[3,6],"randomCount":3,"lastPageId":7,"lastPopId":1,"time":1,"imgRelateCompIds":"","bgIndexs":[],"bgRelateCompId":"","isReturnBack":false}],
  animate: [{"relateCompId":"id"}]
}
export{
  EVENT_ATTR,
  ROTATE3D_LIST,
  INTERACTION_DATA,
  MENU_PATTERN,
  getEventsMap,
  MOUSE_BEHAVIOR,
  EVENTS_RESULTS_TYPES,
  OPEN_PUSH_TYPES,
  EVENT_HOVER_WEB_TYPES,
  TOAST
}